const tailRE = /(?:喵喵喵~|喵喵~|喵喵喵|喵喵|喵~|喵|∽)/g;   // 去掉 $，加 g 能一次清掉多个

export class ignoreMiao extends plugin {
  constructor() {
    super({
      name: '忽略消息',
      dsc: '去掉消息里出现的喵/∽尾巴，覆盖所有指令',
      event: 'message',
      priority: -Infinity - 1,
      rule: [
        { reg: '^.*$', fnc: 'stripTail' }
      ]
    });
  }

  async stripTail() {
    const raw = this.e.raw_message;
    // 直接把所有尾巴全删
    const cleaned = raw.replace(tailRE, '').trim();

    if (cleaned === raw) return false;
    if (!cleaned) return true;

    // 同步字段
    this.e.raw_message = cleaned;
    this.e.msg = cleaned;
    this.e.original_msg = cleaned;
    this.e.message = [{ type: 'text', text: cleaned }];
    return false;
  }
}